<?php
	class common extends control{
		//控制器初始化方法
		public function __construct(){
			parent::__construct();
			$wapModel = $this->model("wap");
			$sets = $wapModel->getSet();
			$types = $wapModel->getType();
			$this->assign('sets',$sets);
			$this->assign('waptype',$types);
			$this->style=$GLOBALS['atwap']['sets']['template_path'];
		}


		//文章列表方法

		public function atlist($pageSize,$listemplate){
			$listModel = $this->model("listm");
			$typeid = Request('typeid');
			$dblist = new DataListCP();
			$dblist ->dsql = $listModel->dsql;
			$dblist->pageSize = $pageSize;
			$dblist->SetParameter('c', 'lists');
			$dblist->SetParameter('a', 'list');
			$dblist->SetParameter('typeid', $typeid);
			foreach($GLOBALS['atwap']['waptype'] as $value){
					if($value['typeid']==$typeid){
						$typeid = $value['cat'];
						break;
					}
					
				}
			$dblist->SetTemplate(DEDEATWAP.'/templates/'.$GLOBALS['atwap']['sets']['template_path'].'/'.$GLOBALS['atwap']['sets']['list_template']);
			$dblist->SetSource("select * from `#@__archives` where `typeid`='$typeid' and `arcrank`=0");
			$dblist->Display();
			$dblist->Close();
		}
		

		//模板赋值方法

		public function assign($name,$value){
			$GLOBALS['atwap'][$name] = $value;
		}



	}
?>